package com.duowan.realtime.model.util;

import java.util.Arrays;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;

import com.duowan.realtime.model.Constants;

public class MapKVUtils {
	public static Object[] extractKvStrToArray(String kv) {
    	Iterator<String> it = Arrays.asList(kv.split(Constants.COLLECTION_DELIMITER)).iterator();
        List<String> kvList = new LinkedList<String>();
        while (it.hasNext()) {
            String oneKv = it.next();   // a string: key/003value
            Iterator<String> tempIt = Arrays.asList(oneKv.split(Constants.MAP_KEY_DELIMITER)).iterator();
            while (tempIt.hasNext()) {
                kvList.add(tempIt.next());
            }
        }
        return kvList.toArray();
    }
}
